//
//  GraphicNumberView.m
//  Teximeter
//
//  Created by BEA DONG HWAN on 11. 2. 7..
//  Copyright 2011 Ajou University. All rights reserved.
//

#import "GraphicNumberView.h"


@implementation GraphicNumberView

- (id)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code.
		backgroundView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
		numberImageView =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
		[backgroundView setImage:[UIImage imageNamed:@"number_bg.png"]];
		[numberImageView setImage:[UIImage imageNamed:@"number_0.png"]];
		[self addSubview:backgroundView];
		[self addSubview:numberImageView];
		[backgroundView setContentMode:UIViewContentModeScaleAspectFit];
		[numberImageView setContentMode:UIViewContentModeScaleAspectFit];
		currentNumber = 0;
		[self setBackgroundColor:[UIColor clearColor]];
    }
    return self;
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code.
 }
 */


-(int)getCurrentNumber {
	return currentNumber;	
}
-(void)setCurrentNumber:(int)number{
	
	if(number==-1)
	{
		[numberImageView setImage:nil];
	}
	else
	{
		[numberImageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"number_%d",number]]];
	}
		
	
}
- (void)dealloc {
	[backgroundView release];
	[numberImageView release];
    [super dealloc];

}

@end
